import request from '@/utils/request'

//查询角色列表
export function findRolePage(current,size,roleVO){
  return request({
    url : '/role/findRolePage',
    method : 'post',
    params : {
      current,
      size
    },
    data : roleVO
  })
}

//角色信息导出到excel
export function toExcel(){
  return request({
    url : '/role/excel',
    method : 'post',
    responseType: 'blob',
  })
}

//获取菜单树和角色拥有的菜单id
export function findRoleMenu(id){
  return request({
    url: '/role/findRoleMenu',
    method: 'get',
    params: {
      id
    }
  })
}

//授权
export function authority(id,mids){
  return request({
    url : '/role/authority',
    method: 'post',
    params: {
      id,
    },
    data : mids
  })
}

/**
 * 查询所有角色列表
 * @returns 
 */
export function getRoleList(){
  return request({
    url: '/role/getRoleList',
    method: 'get'
  })
}

 /**
  * 添加角色
  * @param {} roleVO 
  * @returns 
  */
export function roleAdd(roleVO){
  return request({
    url: '/role/add',
    method: 'post',
    data : roleVO
  })
}

/**
 * 更新角色
 * @param {*} id 
 * @param {*} roleVO 
 * @returns 
 */
export function roleUpdate(id,roleVO){
  return request({
    url: '/role/update',
    method: 'put',
    params:{
      id
    },
    data: roleVO
  })
}

/**
 * 更新角色状态
 * @param {} id 
 * @param {*} status 
 * @returns 
 */
export function roleUpdateStatus(id,status){
  return request({
    url: '/role/updateStatus',
    method: 'put',
    params: {
      id,
      status
    },
  })
}

/**
 * 删除角色
 * @param {} id 
 * @returns 
 */
export function roleDelete(id){
  return request({
    url: '/role/delete',
    method: 'delete',
    params: {
      id
    }
  })
}

